1. Field of the Invention
The present invention relates to a method and a device for measuring the distance of an object. In particular, the method and device of this invention further enable an optical code provided on the object to be read.
2. Discussion of Prior Art
A measurement of the distance of an object from a measuring device is of high utility and sometimes fundamental in several technical fields. This is the case, for example, of all those machining processes where a knowledge of the distance to a surface being machined from the machine tool is necessary for correct positioning of the tools and/or for exact programming of the machine; or all those instances where a knowledge of the distance parameter can allow instruments to be set for optimum processing (e.g., in optics and photography, where the distance parameter is closely related to the focusing problem).
Furthermore, a measurement of the distance to an object is often needed in object handling and sorting systems, wherein objects even markedly different in size may have to be identified and classified, and the object dimensions must be detected automatically in order to speed up and optimize subsequent object routing and storing steps.
Such systems typically include a belt conveyor, onto which the objects to be identified and sorted are placed, and one or more optical devices, usually of the laser light emitting type (commonly indicated as laser scanners) which are adapted to read optical codes and measure the object dimensions.
For improving the reliability of such reading and measuring operations, an indication of the distance between the object and the laser scanner is preferably provided first. In fact, a knowledge of the distance parameter is useful, on the one hand, to properly focus the emitted laser beam onto the object to be scanned, such that the optical code placed on the object can be read correctly, and on the other hand, to find out the object dimensions, such as its volume, for example. In addition, a knowledge of the distance parameter in real time advantageously allows the circuits to be xe2x80x9cparametrizedxe2x80x9d.
Optical devices capable of providing an indication of the distance to an object have been known. For example, European Patent Application No. 0 652 530 of the same Applicant discloses a laser scanner with high-frequency modulated laser light emission, wherein the distance of the object is obtained as a function of the phase difference between the emitted signal by the scanner and the received signal. In particular, the scanner comprises a laser light emitting source which is amplitude modulated by a local oscillator, an optical scan means for directing the laser light toward an object to be scanned, and a light-receiving means for picking up light diffused by the illuminated object and generating an electric signal which is proportional to the intensity of the diffused light. The signal generated by the light-receiving means is sent to a phase demodulator which also receives a signal from the local oscillator; the demodulator measures a phase difference between said two signals, and produces an electric signal which is proportional to this phase difference.
A suitable calculating means then processes said electric signal to calculate a distance value as a function of said phase difference.
Other devices have also been known which measure the distance of an object on the basis of the so-called xe2x80x9cflight timexe2x80x9d of a pulse applied to an emission laser.
Specifically, the time taken by the pulse to travel along the optical path from the emitting means to the object, and from the object to the light receiving means, is measured. This time is proportional to twice the distance of the object from the device.
It has been found that the above-described devices cannot provide an adequately accurate measurement of distance, due to a number of drawbacks discussed in greater detail hereinafter.
A first drawback of modulated light devices is that variations in the device operative temperature bring about an uncontrolled variation in the transfer function distance signal/distance, specifically a variation in the phases of respectively the emitted and received signals by the device, which significantly affects the distance measurement. In fact, the laser is modulated by turning it on and off according to a given duty-cycle (e.g., for a 40 MHz modulation, the laser would be turned on/off 40,000,000 times per second), the duty-cycle being the ratio of the laser xe2x80x9conxe2x80x9d duration and the period. In order for the system to maintain a constant average output power as temperature changes (a useful condition to keep the read performance of an optical code unvaried), a control circuit is provided whose side effect is that of varying the modulation duty-cycle according to the operative temperature variation; however, this variation in the duty-cycle brings about an uncontrolled variation in the phase of the signal emitted by the laser light source.
Likewise, with specific reference to avalanche silicon light receivers (wherein the light receiver gain is established by the reverse bias voltage), to provide the light receiving means with a constant gain as temperature changes (a condition which is also useful to keep the read performance of an optical code unvaried), a compensation circuit is provided and effective to vary the reverse voltage of the signal generated thereby (and hence, as a side effect, the capacity of the light receiving means too) as the operative running temperature changes; this variation implies an uncontrolled phase variation of the output signal from the light receiving means.
Throughout this specification and the appended claims, the term gain (or reception sensitivity)of the light receiving means, is used to indicate the ratio between the voltage actually generated by the light receiving means and the actual optical signal received.
The electronic components which are comprised into the device (specifically, the phase demodulator thereof) also introduce in the transfer function uncontrollable variations with temperature.
Another drawback of modulated light devices is associated to the value of the ratio between the signal detected by the light receiving means and noise (S/N), which ratio may be quite small for objects placed far or near enough and/or dark objects. In such circumstances, a sufficiently clean signal can be obtained only by an intensive signal filtering procedure
A further drawback is associated to the variation of the error of the distance signal according to the optical signal detected by the light receiving means; this is due to operational limitations and to the high sensitivity of the device to changes in reflectance of the objects.
In summary, it has been found that all of the above drawbacks affecting modulated light devices imply an overall error in the distance measurement which can be estimated at about xc2x15%. This percentage of error restricts the usability of the above-described devices to just those applications where the distance measurement need not to be highly accurate and repeatable.
It has been found, moreover, that pulse devices, while being immune from the aforementioned drawbacks, still have problems which cause accuracy and repeatability errors, to be estimated at about xc2x115cm, so that they are particularly suitable for distance measurements of large size objects and objects having relatively large scanned areas. In addition, also in this case the measurements are deeply affected by the reflectance of the objects, changing temperature, etc.
Measurement errors are also introduced, with both modulated light devices and pulse devices, by the ageing and the dimensional tolerances of the device optical and electronic components.
To measure a distance, devices incorporating LEDs, or devices provided with ultrasonic and/or radio-wave emitting means, could be used instead of laser devices. However, such devices are inadequate to provide reliable and accurate distance measurements. In addition, LEDs can only be used for measuring short distances, while by ultrasonic emitting means, the distance measurement is strongly affected by the conditions (density, pressure, etc.) of the transmission medium.
Thus, all of the distance measuring devices discussed hereinabove exhibit errors or inaccuracies in their measurements due to the component tolerances, ageing of the components, and to the electronics.
The underlying technical problem of this invention is to provide a highly accurate and repeatable measurement of the distance of an object, which is unaffected by variations in the aforementioned components, their ageing, and by such ambient variations as temperature, and this regardless of the size of the scanned area containing the object to be measured as well as of the object size and reflectance.
According to a first aspect of this invention, a method is provided for measuring the distance of an object from a measuring device, comprising the steps of:
a) emitting a signal;
b) directing the signal to an object;
c) detecting the signal diffused by the object;
d) comparing the detected signal with the emitted signal, to obtain a comparison signal representing the distances travelled by the emitted and the object diffused signals;
and characterized in that it comprises a step of:
e) setting the measuring device to define a predetermined operational reference configuration in the device.
The method of this invention allows to carry out a distance measurement which is much more stable, accurate and reliable than that to be obtained with conventional devices and methods. The setting step, in fact, allows the device to be set (or calibrated) for a predetermined reference configuration, and an optimum configuration to be maintained as close as possible to the reference configuration throughout the device life span. Thus, an important improvement is achieved in performance which can overcome the drawbacks above mentioned with regard to the conventional devices. In particular, an accurate and repeatable measurement of distance can be carried out regardless of variations in ambient conditions and of the component ageing.
Preferably, the setting step e) comprises a step of defining at least one reference signal representing at least one predetermined distance value. More preferably, the setting step e) includes a step of defining three reference signals representing three predetermined distance values, respectively a minimum, maximum, and middle value.
Preferably, the setting step e) further includes the following steps:
e1) directing the emitted signal to a reference means located at said predetermined distance;
e2) detecting the signal diffused by the reference means;
e3) comparing the detected signal with the emitted signal to obtain a comparison signal representing the distances travelled by the emitted signal and the signal diffused by the reference means;
e4) comparing the comparison signal thus obtained with said reference signal;
e5) calibrating at least one operational parameter of the device such that the comparison signal obtained during step e3) is substantially equal, within predetermined tolerance limits, to said reference signal.
Throughout this specification and the appended claims, the expression xe2x80x9creference signalxe2x80x9d is used to indicate a signal which has a predetermined value and is generated by reference means placed at a predetermined distance. The term xe2x80x9ccalibrationxe2x80x9d is used to indicate the adjustment of a parameter of the device, or of an emitted, received, or obtained signal by the device, according to the predetermined value of the reference signal; the term xe2x80x9csettingxe2x80x9d is used to indicate all the steps involved in generating the reference signal and then adjusting the device parameters or signals according to the reference signal.
In alternative embodiments of the inventive method, the emitted signal may comprise sound or radio waves.
In a preferred embodiment of the inventive method, the emitted signal comprises a preferably collimated light beam, and more preferably, a laser light beam.
Preferably, the laser beam is modulated by a local oscillator.
In an alternative embodiment, the method of this invention comprises a step of generating a pulse in the laser light beam.
Advantageously, the calibrating step e5) is carried out periodically.
Preferably, the reference means comprises at least one reference target located at said predetermined distance and having known reflectance, and the setting step e) includes the following steps:
illuminating the reference target;
picking up the light diffused by the reference target;
generating an electric signal proportional to said picked-up light;
processing the electric signal to calculate the distance of the reference target from the device.
Preferably, the step of calculating the distance of the object includes the following steps:
measuring the phase difference between the detected signal and a signal emitted by the local oscillator;
generating an electric signal proportional to said phase difference;
calculating the distance of the object as a function of said phase difference.
The calibration step preferably includes a step of controlling the phase of the signal generated according to the phase difference between the detected signal and the signal emitted by the local oscillator. More preferably, the calibration step includes the step of controlling both the gain and the offset of the signal generated according to thee phase difference between the detected signal and the signal emitted by the local oscillator.
According to an alternative embodiment, the method of this invention comprises a step of regulating the oscillation frequency of the local oscillator such that accurate and reliable distance measurements can be made for a large number of distance ranges.
Advantageously, the phase of the laser light beam is varied between 0xc2x0 and 180xc2x0. More advantageously, the method of the invention comprises a step of varying the phase of a system clock between 0xc2x0 and 90xc2x0.
Preferably, the step a) of emitting a signal includes a step of emitting an infrared laser light beam and a red laser light beam.
Alternatively, the step a) of emitting a signal includes a step of emitting a plurality of laser beams by a plurality of laser assemblies with different wavelengths. In this way, all of the laser assemblies can be activated sequentially, and that laser assembly for which the detected signal according to the object reflectance exceeds a predetermined reference threshold is held xe2x80x9conxe2x80x9d. Alternatively, all the laser assemblies can be activated sequentially, and that laser assembly which gives the best detected signal according to the object reflectance is held xe2x80x9conxe2x80x9d.
Advantageously, the method of this invention further comprises the following steps:
generating at least one scan on the object along at least one scan line;
carrying out a plurality of distance measurements along the scan line.
More advantageously, the method of this invention comprises a step of reading an optical code placed on the object.
Advantageously, the method of this invention can be carried out by a device according to a second aspect of this invention, and afford all of the advantages specified herein below in connection with this device.
Therefore, according to a second aspect, this invention relates to a device for measuring the distance of an object, comprising:
a signal emitting means;
a means for directing the emitted signal toward an object;
a means for detecting the signal diffused by the object;
a means for comparing the detected signal with the emitted signal to obtain a comparison signal representing the distances travelled by the emitted signal and the signal diffused by the object;
and characterized in that it comprises a means for setting the device to define a predetermined operational reference configuration.
The device of this invention provides a distance measurement which is much more stable, accurate and reliable than that provided by conventional measuring devices.
Preferably, the setting means comprises reference means placed at a predetermined distance, and a means of calibrating at least one operational parameter of the device such that the distance measurement of the reference means is substantially equal to the predetermined distance value, within predetermined tolerance limits.
Advantageously, the setting operation consists of creating a reference and then calibrating the device to this reference, prior to making the distance measurement.
The signal emitting means may be of various types. For example, it could comprise either a means of generating sound or radio waves, or could comprise LEDs or generic light emitting devices.
In a preferred embodiment of the device according to this invention, the signal emitting means comprises a means for generating at least one light beam for illuminating the object along an emission optical path, and the diffused signal detecting means detects the light diffused by the object along a receiving optical path and generates an electric signal which is proportional to said diffused light.
Preferably, the light beam is a collimated light beam, and more preferably an amplitude- and/or phase-modulated laser light beam. In this case, the distance measurement is made according to the phase difference between a signal emitted by the signal emitting means and the signal generated by the detecting means according to the light diffused by the illuminated object.
In an alternative embodiment, the laser light beam may be a pulsed laser beam. In this case, the distance measurement is based on the time taken by a pulse applied to the emission laser to travel the optical path from the emitting means to the object, and from the object to the light receiving means.
As previously stated, the device setting is carried out before the distance is measured. Preferably, the setting operation is activated periodically prior to measuring the distance, and is repeated after a predetermined number of distance measurements. This allows the device to be always operated under the same, or substantially similar, operative conditions as those relating to the predetermined reference configuration.
Preferably, the reference means comprises at least one reference target placed at least at a predetermined distance and being of known reflectance. More preferably, the setting means comprises a feedback circuit adapted to control said at least one operational parameter of the device such that a predetermined value of the electric signal generated by the detecting means is obtained upon illuminating the reference target.
The reference configuration of the device is therefore a configuration where the operational parameters of the device take such values that the resulting distance value will, upon the reference target being illuminated and detected, equal the value of the distance at which the target has actually been set. The setting operation is carried out when the above values mismatch. In this circumstance, the feedback circuit is caused to suitably change the operational parameters of the device for bringing the device to an optimal operational configuration which is the closest possible to the predetermined reference configuration.
In a first embodiment of this invention, the reference target is placed outside the device. This requires, however, that the target be correctly positioned within the measurement area, and involves a reduction in the useful area of measurement.
In a preferred embodiment of this invention, the reference target is placed inside the device. Advantageously, the reference target can be positioned anywhere within the device, and includes a highly reflective working surface which is oriented to face the detecting means, thereby facilitating the detection of the light diffused by the reference target during the setting operations. For this purpose, the device of this invention advantageously includes a concave receiving mirror, being placed on the receiving optical path upstream of the detecting means and effective, when illuminated, to pick up the light diffused by the reference target.
Preferably, the reference target is arranged such that the light diffused thereby will reach the concave receiving mirror directly, without undergoing reflection by other optical members, thereby to avoid the possibility of the detecting means being reached by a small amount of light.
In general, the errors in the distance measurements either originate from an undesired phase variation of the signals generated by the emitting means and the light receiving means, or (but to a lesser extent) from an undesired variation in the gain and the overall offset of the device.
Throughout the specification and the appended claims, the term xe2x80x9coffsetxe2x80x9d is used to indicate a positional error on the plane of the phase/distance transfer function.
To provide a distance measurement which is both accurate and repeatable, it is therefore necessary to control all three of the aforementioned operational parameters. For the purpose, the device of this invention advantageously includes three reference targets, being placed at different and predetermined distances. Thus, three different settings can be carried out, each by means of one of the reference targets, arranged to control one of the above operational parameters.
The three targets may be positioned either outside the device or, preferably, inside the device. In the latter case, the three settings can be carried out sequentially (i.e., the emission laser beam can be made to impinge onto each of the reference targets sequentially) by providing a suitable arrangement of emission laser light reflecting mirrors inside the device.
In a preferred embodiment of this invention, the three internal targets are substituted with a single internal reference target and two xe2x80x9cvirtualxe2x80x9d targets, which are suitably formed by means of one or more local oscillators, according to one of the embodiments described hereinafter.
In a particularly preferred embodiment of this invention, the device is a modulated light emitting device and comprises a single internal target, a single local oscillator associated with the laser beam emitting means and adapted to amplitude and phase modulate the light from the emission laser, and a phase demodulator adapted to receive a signal from both the local oscillator and the detecting means as well as to generate a signal dependent on the phase difference between the output signal from the local oscillator and the output signal from the detecting means, thereby to calculate the distance of the illuminated object as a function of said phase difference. Preferably, the device further comprises a variable phase system clock associated with the laser beam emitting means.
A first of the xe2x80x9cvirtualxe2x80x9d targets is provided by varying the phase of the emission laser light from 0xc2x0 to 180xc2x0 relative to the phase of the system clock, by means of the local oscillator. Thus, a signal is generated and detected having a complementary waveform of that of the signal output at 0xc2x0 phase; this signal is totally equivalent to a signal proportional to the light diffused by an imaginary target located at a distance of xcex/2 from the real target.
The second of the xe2x80x9cvirtualxe2x80x9d targets is provided by holding the phase of the emission laser light constant at 0xc2x0 or 180xc2x0 and varying the phase of the system clock from 0xc2x0 to 90xc2x0. Thus, a signal is generated and detected which is totally equivalent to a signal proportional to the light diffused by an imaginary target located at a distance of xcex/4 from the real target.
Advantageously, the oscillation frequency of the local oscillator is adjustable, so that accurate and reliable measurements can be made for a large number of distance ranges.
In a modification of the embodiment described above, the device comprises a single internal target and three local oscillators at different frequencies (which frequencies are, however, related to one another, for instance multiples or submultiples of a predetermined frequency) adapted to enable three signals to be emitted at three different wavelengths which are the equivalents of three signals generated by respective targets placed at three different distances.
Advantageously, the three reference targets (either where three xe2x80x9crealxe2x80x9d targets, or one xe2x80x9crealxe2x80x9d and two xe2x80x9cvirtualxe2x80x9d targets are provided) are arranged such that a first target is located at a first distance which is the same as or shorter than the minimum distance to be measured, a third target is located at a third distance which is the same as or longer than the maximum distance to be measured, and a second target is located at an intermediate distance between the minimum and the maximum distance to be measured.
For the inventive device to operate properly, it is necessary that, during the distance setting steps, the light detected by the light receiving means be exclusively the light diffused by the reference target(s). For this purpose, the device comprises a means of optical protection which is effective to stop undesired light leakage into the device from the outside. Preferably, this means is located, within the device, at opposite ends of a window adapted to face the object.
In the preferred embodiment of the device according to the invention, the optical supports are advantageously mounted in the device in an adjustable way, and one of the two optical supports forms the internal reference target.
Advantageously, the device of this invention comprises a scanning means adapted to generate at least one scan on the object along a scan line to carry out a plurality of distance measurements.
The optical scanning means may be of various types, all suitable for the intended purpose. Preferably, it comprises a polygonal mirror rotor. Alternatively, it may comprise an oscillating mirror, having a movable oscillation plane between two different positions, or a laser source oscillating on a plane movable between two different positions. In a further modified embodiment, it is of a static type (e.g., formed of a solid state static element).
Advantageously, the setting operation can be carried out using scan spots which are unusable for other purposes. In fact, each time that the center of the collimated emission laser beam impinges on a corner edge of the polygonal mirror rotor, two laser light spots are generated which illuminate two respective zones at the beginning and the end of the scan line. The light diffused from these zones cannot be used for distance measurement purposes, and is therefore utilized for carrying out the setting operations.
In the preferred embodiment, the operational parameter controlled by the feedback circuit may be just the phase of the signal generated by the phase demodulator, or preferably, be also the gain and offset of the phase demodulator.
In the former instance, the feedback circuit will act directly on the input signal to the phase demodulator so as to compensate the phase variation which is most responsible for the measurement error.
In the latter instance, the feedback circuit will also act directly on the means for detecting the light diffused by the object, as well as on the phase demodulator. In this way, the feedback circuit is caused to act directly on the optoe]ectronic and electronic components whereat the errors originate.
Preferably, the feedback circuit comprises a circuit for compensating the variations of said at least one operational parameter of the device according to the predetermined reference value of the electric signal generated by the detecting means upon illuminating the reference target. This circuit allows all the causes for error to be compensated, regardless of the components involved and the reasons for such errors.
In particular, the compensation circuit acts on a variable group delay channel filter adapted to enable control of the output signal phase from the phase demodulator, and on an analog multiplier adapted to enable control of the gain and offset of the output signal from the phase demodulator.
In the preferred embodiment of the device according to this invention, the generated signal dependent on the light diffused by the second target (second xe2x80x9cvirtualxe2x80x9d target), is utilized to control the phase of the output signal from the phase demodulator, the generated signal dependent on the light diffused by the first target, is utilized to control the gain of the phase demodulator, and the generated signal dependent on the light diffused by the third target (first xe2x80x9cvirtualxe2x80x9d target), is utilized to control the offset of the phase demodulator. In particular, the generated error signal dependent on the light diffused by the second target, is sent to the variable group delay channel filter to control the phase of the output signal from the phase demodulator, while the generated error signals dependent on the light diffused by the first and third targets, are sent to the analog multiplier to control the gain and offset of the output signal from the phase demodulator.
The output of the phase demodulator is calibrated such that, upon a distance being detected which equals one half the sum of the maximum distance and the minimum distance of the area to be measured, the value of the corresponding electric signal is zero. This condition is dictated by the need to best utilize the linear-most section of the transfer function of the synchronous demodulator (relationship between the relative phase and the distance range). Consequently, two voltages, equal in modulo and opposite in sign, will be output from the phase demodulator at the maximum and the minimum distance.
Preferably, the emitting means comprises a laser assembly arranged to emit in the wavelengths of the red and a laser assembly arranged to emit in the wavelengths of the infrared. More preferably, the laser emitting in the wavelengths of the red is of the unmodulated type and adapted for pointing the object, and the laser emitting in the infrared wavelengths is amplitude and phase modulated and adapted for measuring the distance of the object.
The choice of the infrared laser emitting a laser beam in the 780 nm wavelength advantageously allows to reduce the depth of modulation of the signal diffused by the object. In fact, the variation in amplitude due to variations in reflectance of the object surfaces is far lower at 780 nm, thus providing to get a received signal of sufficient amplitude even with very dark objects in the visible band of the spectrum. In fact, most of the inks used for printing on paper, and most of the paints used for colouring objects of various type (made of plastics, metal, wood, etc.) exhibit, at wavelengths above 750 nm, higher reflectance than when illuminated with wavelengths in the visible spectrum band (400-710 nm).
Alternatively, the emitting means may comprise a plurality of laser assemblies adapted to emit light at different wavelengths. The use of a plurality of lasers having different emission frequencies provides a diffused signal of sufficient amplitude in several operating conditions, even with very dark objects and/or objects placed very far or very near. In fact, each object exhibits maximum reflectance at a given wavelength. Thus, the first laser can be tried, and if the received signal lies below a minimum acceptable threshold, the second is then tried, and so forth. Alternatively, where sufficient time is available, all the laser assemblies can be tried, and only the laser assembly that results in the best received signal for a given object be held xe2x80x9conxe2x80x9d.
Preferably, the device of this invention is also a reader of optical codes. In this case, the electric signal generated by the detecting means, additionally to being used to measure the distance of one point on the object, or several distance on a surface of the object, is processed by the processing means to allow the reading of an optical code placed on the object.
Throughout this specification and the appended claims, the term xe2x80x9coptical codexe2x80x9d is used to indicate a code (such as a bar code, bi-dimensional code, or the like) which univocally identifies the objects bearing it.
Advantageously, the reading of the optical code is effected by the same device used for measuring the distance. Preferably, it comprises an amplitude demodulator, a digitizer, and a decoder. In this way, the distance (or size or volume) information can be associated with other identifying information contained in the optical code, such as the type of product, its manufacturer, price, origin, destination, etc.
Preferably, the device of this invention includes an amplitude demodulator adapted to receive the output signal from the detecting means and to generate a signal representing the object reflectance.
Preferably, the emitting means comprises a single laser emission assembly and an autofocus system, thereby to increase the field depth of the device and thus allow the optical codes of objects placed at different distances to be read.
Alternatively, the emitting means may comprise a plurality of laser assemblies focused for different distances.
Preferably, the device of this invention further includes a signaling means adapted to generate a warning signal upon the occurrence of predetermined malfunctions in the device.